package org.atlantis.sbe.websocket

import org.atlantis.sbe.websocket.WebSocketServer._
import org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

object WebSocketServerMain {

	def main(args: Array[String]): Unit = {
		val conf = new WebSocketServerConfig {
			val port = 6868
			val listenOn = "0.0.0.0"
		}
		
		var server = WebSocketServer(conf) {
			case Connect(_) => println("")
			case TextMessage(channel, text) => channel.write(new TextWebSocketFrame("ECHO: " + text))
			case Disconnected(_) => println("client disconnected")
		}
		
		server start
	}
}